﻿namespace Dcms.UpdateModule
{
    using Dcms.Config;
    using System;
    using System.Data;
    using System.Reflection;

    public class DcmsSiteInfoProcessCode
    {
        private bool EntityToDataTable(ref DataTable dt, object obj)
        {
            bool flag = false;
            try
            {
                DataRow row = dt.NewRow();
                PropertyInfo[] properties = obj.GetType().GetProperties();
                foreach (PropertyInfo info in properties)
                {
                    dt.Columns.Add(info.Name);
                    row[info.Name] = info.GetValue(obj, null);
                }
                dt.Rows.Add(row);
                flag = true;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return flag;
        }

        public DataTable SiteInfoList(string SqlStr)
        {
            DataTable dt = new DataTable();
            WebSiteConfigInfo info = WebSiteConfigs.Deserialize("~/SystemConfig/WebSiteInfo.config");
            if (!this.EntityToDataTable(ref dt, info))
            {
            }
            return dt;
        }

        public string SiteInfoModuleSql(string ModelName, string FileList, string ParaName, string DefaultValue, string SelectDir, string ConditionStr, string NumStr, string IsPage, string OrderFileStr, string SortStr, string ParaTypeStr)
        {
            return "0$0$siteinfo$this";
        }
    }
}

